package cn.wolfcode.car.common.base.page;

import cn.wolfcode.car.common.web.StateType;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;


/**
 * 分页对象
 * @param <T>
 */
@Setter
@Getter
public class TablePage<T>{

    private int code;           //返回值状态码：为0是表示成功
    private String msg;         //返回值信息

    private long total;         //分页总条数
    private List<T> rows = new ArrayList<>();       //当前页面显示数据
    public TablePage(Page<T> page){
        this.total = page.getTotal();
        this.rows = page.getRecords();

        //成功
        this.code = StateType.SUCCESS.getValue();
    }
}
